home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 13 / AMIGAplus Sonderheft 13 (1998)(ICP)(DE)[!].iso / rexx / showag.bed < prev    next >
Text File  |  1997-12-03  |  2KB  |  108 lines

  1. /*
  2. ** $VER: ShowAG.bed 1.0 (03.03.96)
  3. **
  4. ** If a block is selected, save this block as an AmigaGuide database,
  5. ** and display it.
  6. **
  7. ** If no block is selected, determine if the cursor is currently within
  8. ** an AmigaGuide node. If so, create an AmigaGuide database containing only
  9. ** this node, and display it.
  10. **
  11. ** If no block is selected, and the cursor is not currently within an
  12. ** AmigaGuide node, display the whole document as an AmigaGuide database.
  13. **
  14. ** Modified by Marco Negri
  15. */
  16.  
  17. OPTIONS RESULTS
  18. OPTIONS FAILAT 21
  19. TRACE RESULTS
  20. SetDisplayLock ON
  21. SetInputLock ON
  22.  
  23. TaskID = Pragma('ID')
  24. tempname = 'T:ShowAG-' || TaskID
  25.  
  26. GetCursorPos
  27. PARSE VAR RESULT cursorLine cursorColumn .
  28.  
  29. GetBlkInfo
  30. PARSE VAR RESULT blockActive . blockLine blockColumn .
  31.  
  32. GetFileInfo
  33. PARSE VAR RESULT . . '"'nodeName'"' .
  34.  
  35. IF blockActive = OFF THEN DO
  36.  
  37.   GetPrefs FindIgnoreCase
  38.   ignore = RESULT
  39.   SetPrefs FindIgnoreCase ON
  40.  
  41.   GetPrefs FindBackward
  42.   back = RESULT
  43.   SetPrefs FindBackward ON
  44.  
  45.   Find "@node"
  46.   IF RC = 0 THEN DO
  47.     GetLine
  48.     PARSE VAR RESULT . '"' nodeName '"' .
  49.     MoveDown
  50.   END; ELSE DO
  51.     MoveSOF
  52.   END
  53.   MarkBlk
  54.  
  55.   SetPrefs FindBackward OFF
  56.  
  57.   Find "@endnode"
  58.   IF RC > 0 THEN DO
  59.     MoveBookmark 10
  60.   END
  61.  
  62.   IF Open(file, tempname, WRITE) THEN DO
  63.     WriteLn(file,'@database "'nodeName'"');
  64.     WriteLn(file,'@node Main "'nodeName'"');
  65.     Close(file);
  66.   END
  67.  
  68.   CopyBlk UNIT 314
  69.   SaveClip UNIT 314 QUIET NOICON NOBACKUP APPEND tempname
  70.  
  71.   SetPrefs FindBackward back
  72.   SetPrefs FindIgnoreCase ignore
  73.  
  74.   IF Open(file, tempname, APPEND) THEN DO
  75.     WriteLn(file,"@endnode");
  76.     Close(file);
  77.   END
  78.  
  79. END; ELSE DO
  80.   GetBlk lines
  81.  
  82.   IF Open(file, tempname, WRITE) THEN DO
  83.     WriteLn(file,'@database "'nodeName'"');
  84.     WriteLn(file,'@node Main "'nodeName'"');
  85.  
  86.     DO i = 1 TO lines.0
  87.       WriteCh(file,lines.i)
  88.     END
  89.     WriteLn(file,"")
  90.     WriteLn(file,"@endnode");
  91.     Close(file)
  92.     DROP lines.
  93.   END
  94. END
  95.  
  96. SetDisplayLock OFF
  97. SetInputLock OFF
  98.  
  99. ADDRESS COMMAND 'MultiView' tempname
  100.  
  101. IF ~Show(L,'rexxsupport.library') THEN DO
  102.   AddLib('rexxsupport.library',0,-30)
  103. END;
  104.  
  105. ADDRESS COMMAND 'Wait 10'
  106.  
  107. Delete(tempname)
  108.